import os


def handle_profile(base_path: str, profile_name: str = "train"):
    base_path = os.path.abspath(base_path)
    output_file = f"{profile_name}_seqmap.txt"
    output_file = os.path.join(base_path, output_file)

    data_dir = os.path.join(base_path, profile_name)
    
    if not os.path.exists(data_dir):
        return

    dir_list = os.listdir(data_dir)
    dir_list = [d for d in dir_list if os.path.isdir(os.path.join(data_dir, d))]

    with open(output_file, "w") as f:
        for d in dir_list:
            f.write(f"{d}\n")


if __name__ == "__main__":
    base_path = r"/home/konghaomin/Datasets/SMD_DanceTrack_Spilt/DanceTrack"

    handle_profile(base_path, "train")
    handle_profile(base_path, "val")
    handle_profile(base_path, "test")
